Add tabIndex to mobile nav toggle #1081
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
The mobile hamburger menu is not currently accessible either by keyboard or screenreader, per issue #978 .
What
As noted by @bacitracin in #978 , the required change is extremely simple. We just add a
tabIndex
onto the mobile nav toggle and the browser takes care of the rest.NB
I've added a comment to the ticket which follows this one, #979 , but the menu items for the mobile menu are accessible via tab...but only at the very very end of the tab order, past the bottom of the page. This is because the mobile menu is loaded into the html at the very end of the document, in spite of being located within the
Header
component in the React code. I don't know why this would be! Possibly not an issue since we want to access them via keyboard up-down arrows anyway, but thought it would be worth noting in case anyone has insights.Screen captures of current behavior in prod and locally
Current behavior in production:
(User tabs through page, starting with main
Clean & Green Philly
icon in nav, and tabs directly into the page content without accessing theMenu
hamburger toggle.)Tabbing.past.menu.toggle.on.prod.1.15.25.mov
Adjusted behavior in local with these changes:
(User tabs through page and successfully tabs to
Menu
hamburger toggle, which opens and closes appropriately onEnter
.)Tabbing.to.menu.toggle.on.local.1.15.25.mov
Steps to test
focus
the mobilefocus
styles (a standard blue halo around the element)Enter
orSpace
the menu should openEnter
orSpace
key again should close the menu